package DesignPattern.CommandPattern;

// 具体的乘法命令
public class MultiplyCommand implements Command {
    private Calculator calculator;
    private int operand;

    public MultiplyCommand(Calculator calculator, int operand) {
        this.calculator = calculator;
        this.operand = operand;
    }

    @Override
    public void execute() {
        calculator.multiply(operand);
    }

    @Override
    public void undo() {
        calculator.divide(operand);
    }
}